package gl.android.widget.radio;

import gl.android.biyiqing.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;

public class RoundRadioGroup extends RadioGroup {

	public RoundRadioGroup(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	

	private void init() {}



	@Override
	protected void onFinishInflate() {
		super.onFinishInflate();
		for (int i = 0; i < getChildCount(); i++) {
			View child = getChildAt(i);
			if (child instanceof RadioButton) {
				final RadioButton button = (RadioButton) child;
				if (i == 0) {
					button.setBackgroundResource(R.drawable.gl_sel_tab_corner_left);
				} else if (i == getChildCount() - 1) {
					button.setBackgroundResource(R.drawable.gl_sel_tab_corner_right);
				} else {
					button.setBackgroundResource(R.drawable.gl_sel_tab_corner_center);
				}
			}
		}

	}

}
